﻿/**
* APP 的初始配置页面
*/

class ConfigurationPage extends UiFramework.UiAbstract
{
    onStart(divSelf: HTMLDivElement)
    {
        // 添加主机按钮
        var addHostBtn = document.createElement("input");
        addHostBtn.type = "button";
        addHostBtn.value = "添加主机";
        addHostBtn.style.top = "20%";
        addHostBtn.className = "ConfigurationPageBut";
        this.divSelf.appendChild(addHostBtn);

        // 添加设备按钮
        var addEquipment = document.createElement("input");
        addEquipment.value = "添加设备";
        addEquipment.type = "button";
        addEquipment.style.top = '40%';
        addEquipment.className = "ConfigurationPageBut";
        this.divSelf.appendChild(addEquipment);

        // 情景设置按钮 Scene mode
        var addSceneSet = document.createElement("input");
        addSceneSet.value = "情景设置";
        addSceneSet.type = "button";
        addSceneSet.style.top = '60%';
        addSceneSet.className = "ConfigurationPageBut";
        this.divSelf.appendChild(addSceneSet);

        // 添加主机按钮的点击跳转
        addHostBtn.onclick = () =>
        {
            this.stateMgr.changeStateByName("loading");
        }

        // 添加设备按钮的点击跳转
        addEquipment.onclick = () =>
        {
            this.stateMgr.changeStateByName("addEquipment");
        }

        addSceneSet.onclick = () =>
        {
            this.stateMgr.changeStateByName("equipmentList");
        }
    }

    onEnd()
    {
    }

}

UiMap["configureUI"] = () =>
{
    return new ConfigurationPage();
}